package com.niit.config;

import com.niit.beans.Cat;
import com.niit.beans.Sheep;
import com.niit.beans.Zoo;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Scope;

@Configuration // 1.当前被声明一个bean定义的文件
//@Import(BeanConfiguration2.class)
public class BeanConfiguration {

    @Bean // 2.声明一个bean
    @Scope("singleton")
    public Cat cat(){
        return new Cat();
    }

    @Bean
    public Zoo zoo(Sheep sheep){
        Zoo zoo = new Zoo();
        zoo.setSheep(sheep);
        return zoo;
    }
}
